x86/mm: early put_page when XENMEM_add_to_physmap(XENMAPSPACE_gmfn)
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 24 Dec 2009 09:06:12 +0000 (09:06 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 24 Dec 2009 09:06:12 +0000 (09:06 +0000)
commitd69fe482f95c4c3a97fcab78ab8f69a79d437b50
treece313f167253086ba347cc2962f5be420b1988d2
parent3781952178f3424cbb3b64190990ecff21e8643e
x86/mm: early put_page when XENMEM_add_to_physmap(XENMAPSPACE_gmfn)

When using a stub domain, xen massively complains as follows:

(XEN) sh error: sh_remove_all_mappings(): can't find all mappings of
mfn be=
3c5: c=3D8000000000000004 t=3D00000000
(XEN) sh error: sh_remove_all_mappings(): can't find all mappings of
mfn be=
3c4: c=3D8000000000000004 t=3D00000000
...

This comes from the XENMEM_add_to_physmap hypercall from hvmloader.

The guest_physmap_remove_page function calls sh_remove_all_mappings()
which checks reference count of the page. Then, calling
guest_physmap_remove_page after temporarily get_page is obviously
wrong. And early put_page is harmless here since domain_lock is
acquired.

Also, the restore program seems not to complain extra mappings
long before. Instead, the stub domain does. Thus the comment in
sh_remove_all_mappings() is rewritten.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
xen/arch/x86/mm.c
xen/arch/x86/mm/shadow/common.c